enum Level {
    INFO = 0,
    DEBUG,
    WARN,
    ERROR
};


#define LOG_LEVEL INFO
#define LOG(Level, format,...) do {\
    if(Level<LOG_LEVEL) break;\
    time_t now = time(NULL);\
    struct tm* local=localtime(&now);\
    char temp[32]={0};\
    strftime(temp,31,"%Y-%m-%d %H:%M:%S",local);\
    fprintf(stdout,"[%s %s:%d]" format "\n" ,temp,__FILE__,__LINE__,##__VA_ARGS__);\
}while (0)

#define LOG_INFO(format,...) LOG(INFO,format,##__VA_ARGS__)
#define LOG_DEBUG(format,...) LOG(DEBUG,format,##__VA_ARGS__)
#define LOG_WARN(format,...) LOG(WARN,format,##__VA_ARGS__)
#define LOG_ERROR(format,...) LOG(ERROR,format,##__VA_ARGS__)


